/**
 * Created by Administrator on 2018/4/26.
 */
//以iphone6宽375px为标准 1px=0.01rem
(function (doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function () {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            docEl.style.fontSize = 100 * (clientWidth / 375) + 'px';
        };

    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);

// 了解一下这个函数,我自己写的
(function (screenwidth) {
    var divObj=document.createElement("div");
    var htmlElem = document.getElementsByTagName("html")[0];
    htmlElem.appendChild(divObj);
    var isBrowser = comm.browserType();
    htmlElem.style.fontSize = "100px";
    var winW = divObj.offsetWidth;
    if (isBrowser.isPC) {
        htmlElem.style.fontSize = "200px";
    } else {
        var fontSizeNum = (100 / screenwidth) * winW;
        var fontSizeRatio = parseInt( htmlElem.style.fontSize.replace(/[^0-9]/ig,"") / 100 );
        htmlElem.style.fontSize = (fontSizeNum / fontSizeRatio)+"px";
    }
})